import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:yt_devops/components/gaps.dart';
import 'package:yt_devops/components/log_utils.dart';

import '../../../../../resources/resources.dart';
import '../../../../../resources/str_res_keys.dart';
import '../../../../../styles/styles.dart';

enum AccessProgressType {
  normalInfo, //基本信息
  paramSet, //参数设置
  completed, //接入完成
}

class InfoHeaderView extends StatelessWidget {
  final AccessProgressType type;
  const InfoHeaderView( this.type, {Key? key})
      : super(key: key);
  @override
  Widget build(BuildContext context) {
    List<String> headerList = [
      ResKey.baseInfo.tr,ResKey.parameterSets.tr, ResKey.siteDeviceAccessComplete.tr,
    ];
    int  index = 0;
    if(type == AccessProgressType.paramSet){
      index = 1;
    }else if(type == AccessProgressType.completed){
      index = 2;
    }
    var lineWidth = (ScreenUtil().screenWidth - 12.w * 4 - 53.w * 2 - 20.w * 3) / 2;
    return Container(
      height: 76.h,
      color: Colors.white,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        // crossAxisAlignment: CrossAxisAlignment.stretch,
        children: [
          // Gaps.vGap10,
          Row(
            children: [
              SizedBox(
                width: 53.w,
              ),
              Image.asset(index > 0 ?ImageAssets.siteAccessDeviceSuccess:ImageAssets.siteAccessDeviceOne),
              Gaps.hGap2,
              Container(height: 1,width:lineWidth,color: index > 0?Colour.primaryColor:Colour.grayE7Color,margin: const EdgeInsets.symmetric(horizontal: 12),),
              Image.asset(index == 0?ImageAssets.siteAccessDeviceTwo:(index > 1 ?ImageAssets.siteAccessDeviceSuccess:ImageAssets.siteAccessDeviceOne)),
              Container(height: 1,width:lineWidth,color: index > 1?Colour.primaryColor:Colour.grayE7Color,margin: const EdgeInsets.symmetric(horizontal: 12),),
              Image.asset(index >= 2 ?ImageAssets.siteAccessDeviceSuccess:ImageAssets.siteAccessDeviceThree),
            ],
          ),
          Row(
            children: [
              SizedBox(
                width: 38.w,
              ),
              Text(
                headerList[0],
                style: TextStyle(
                    color: Colour.mainTextColor,
                    fontSize: 12.sp,
                    fontWeight: FontWeight.normal),
              ),
              const Spacer(),
              Text(
                headerList[1],
                style: TextStyle(
                    color: index > 0?Colour.mainTextColor:Colour.diabledButtoBgColor,
                    fontSize: 12.sp,
                    fontWeight: FontWeight.normal),
              ),
              const Spacer(),
              Text(
                headerList[2],
                style: TextStyle(
                    color: index > 1?Colour.mainTextColor:Colour.diabledButtoBgColor,
                    fontSize: 12.sp,
                    fontWeight: FontWeight.normal),
              ),
              SizedBox(
                width: 38.w,
              ),
            ],
          ),
          Gaps.vGap8,
        ],
      ),
    );
  }


}
